package com.fsnbigdata.domain;
import org.hibernate.validator.constraints.Length;
import org.springframework.roo.addon.javabean.annotations.RooEquals;
import org.springframework.roo.addon.javabean.annotations.RooJavaBean;
import org.springframework.roo.addon.javabean.annotations.RooToString;
import org.springframework.roo.addon.jpa.annotations.entity.RooJpaEntity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Version;
import io.springlets.format.EntityFormat;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import java.util.Objects;
import javax.persistence.Entity;

/**
 * = Introduction
 *
 * TODO Auto-generated class documentation
 *
 */
@RooJavaBean
@RooToString
@RooJpaEntity(entityFormatExpression = "#{introNo}")
@RooEquals(isJpaEntity = true)
@Entity
@EntityFormat("#{introNo}")
public class Introduction {

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @Version
    private Integer version;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @EntityFormat
    private PlantConservation plantConservation;

    /**
     * 引种号
     */
    @Length(min = 0, max = 255,message = "introNo长度必须0-255之间")
    private String introNo;

    /**
     * 登记时间-年
     */
    @Length(min = 0, max = 255,message = "addYear长度必须0-255之间")
    private String addYear;

    /**
     * 登记时间-月
     */
    @Length(min = 0, max = 255,message = "addMonth长度必须0-255之间")
    private String addMonth;

    /**
     * 登记时间-日
     */
    @Length(min = 0, max = 255,message = "addDay长度必须0-255之间")
    private String addDay;

    /**
     * 材料名称
     */
    @Length(min = 0, max = 255,message = "materialName长度必须0-255之间")
    private String materialName;

    /**
     * 数量
     */
    @Length(min = 0, max = 255,message = "quantity长度必须0-255之间")
    private String quantity;

    /**
     * 采集人
     */
    @Length(min = 0, max = 255,message = "recorder长度必须0-255之间")
    private String recorder;

    /**
     * 国家
     */
    @Length(min = 0, max = 255,message = "country长度必须0-255之间")
    private String country;

    /**
     * 省
     */
    @Length(min = 0, max = 255,message = "province长度必须0-255之间")
    private String province;

    /**
     * 县
     */
    @Length(min = 0, max = 255,message = "county长度必须0-255之间")
    private String county;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    public static final String ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE = "The given Iterable of items to add can't be null!";

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    public static final String ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE = "The given Iterable of items to add can't be null!";

    /**
     * This `equals` implementation is specific for JPA entities and uses
     * the entity identifier for it, following the article in
     * https://vladmihalcea.com/2016/06/06/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
     *
     * @param obj
     * @return Boolean
     */
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        // instanceof is false if the instance is null
        if (!(obj instanceof Introduction)) {
            return false;
        }
        return getId() != null && Objects.equals(getId(), ((Introduction) obj).getId());
    }

    /**
     * This `hashCode` implementation is specific for JPA entities and uses a fixed `int` value to be able
     * to identify the entity in collections after a new id is assigned to the entity, following the article in
     * https://vladmihalcea.com/2016/06/06/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
     *
     * @return Integer
     */
    public int hashCode() {
        return 31;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Long
     */
    public Long getId() {
        return this.id;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Integer
     */
    public Integer getVersion() {
        return this.version;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param version
     */
    public void setVersion(Integer version) {
        this.version = version;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return PlantConservation
     */
    public PlantConservation getPlantConservation() {
        return this.plantConservation;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param plantConservation
     */
    public void setPlantConservation(PlantConservation plantConservation) {
        this.plantConservation = plantConservation;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getIntroNo() {
        return this.introNo;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param introNo
     */
    public void setIntroNo(String introNo) {
        this.introNo = introNo;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getAddYear() {
        return this.addYear;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param addYear
     */
    public void setAddYear(String addYear) {
        this.addYear = addYear;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getAddMonth() {
        return this.addMonth;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param addMonth
     */
    public void setAddMonth(String addMonth) {
        this.addMonth = addMonth;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getAddDay() {
        return this.addDay;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param addDay
     */
    public void setAddDay(String addDay) {
        this.addDay = addDay;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getMaterialName() {
        return this.materialName;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param materialName
     */
    public void setMaterialName(String materialName) {
        this.materialName = materialName;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getQuantity() {
        return this.quantity;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param quantity
     */
    public void setQuantity(String quantity) {
        this.quantity = quantity;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getRecorder() {
        return this.recorder;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param recorder
     */
    public void setRecorder(String recorder) {
        this.recorder = recorder;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getCountry() {
        return this.country;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param country
     */
    public void setCountry(String country) {
        this.country = country;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getProvince() {
        return this.province;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param province
     */
    public void setProvince(String province) {
        this.province = province;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getCounty() {
        return this.county;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param county
     */
    public void setCounty(String county) {
        this.county = county;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String toString() {
        return "Introduction {" + "id='" + id + '\'' + ", version='" + version + '\'' + ", introNo='" + introNo + '\'' + ", addYear='" + addYear + '\'' + ", addMonth='" + addMonth + '\'' + ", addDay='" + addDay + '\'' + ", materialName='" + materialName + '\'' + ", quantity='" + quantity + '\'' + ", recorder='" + recorder + '\'' + ", country='" + country + '\'' + ", province='" + province + '\'' + ", county='" + county + '\'' + ", ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE='" + ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE + '\'' + ", ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE='" + ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE + '\'' + "}" + super.toString();
    }
}
